added Feb 2001 SDK
[windows-sources.git] / shared source / sscli20 / jscript / engine / jspropertyfield.cs
blob988c845c78c167f8dbeb14dbd198153cfe16d2ae
1 // ==++==
2 //
3 //
4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
5 //
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
10 //
11 // You must not remove this notice, or any other, from this software.
12 //
13 //
14 // ==--==
16 // Makes a PropertyInfo look like a FieldInfo for use in compiled with statements
18 namespace Microsoft.JScript {
20 using System;
21 using System.Globalization;
22 using System.Reflection;
24 internal sealed class JSPropertyField : JSField{
25 internal PropertyInfo wrappedProperty;
26 internal Object wrappedObject;
28 internal JSPropertyField(PropertyInfo field, Object obj){
29 this.wrappedProperty = field;
30 this.wrappedObject = obj;
33 public override String Name{
34 get{
35 return this.wrappedProperty.Name;
39 public override FieldAttributes Attributes{
40 get{
41 return FieldAttributes.Public;
45 public override Type DeclaringType{
46 get{
47 return this.wrappedProperty.DeclaringType;
51 public override Type FieldType{
52 get{
53 return this.wrappedProperty.PropertyType;
57 public override Object GetValue(Object obj){
58 return this.wrappedProperty.GetValue(this.wrappedObject, new Object[0]);
61 public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo locale){
62 this.wrappedProperty.SetValue(this.wrappedObject, value, invokeAttr, binder, new Object[0], locale);